﻿<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	exclude-result-prefixes="msxsl">

  <xsl:output media-type="text/plain" method="text" indent="yes" encoding="utf-8" />

  <xsl:template match="/">

    <xsl:apply-templates select="TypeListing" />

  </xsl:template>

  <xsl:template match="TypeListing">
    <topic>
      <xsl:attribute name="id"><xsl:value-of select="@ID" /></xsl:attribute>
      <xsl:attribute name="revisionNumber">1</xsl:attribute>

      <xsl:text disable-output-escaping="yes"><![CDATA[<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">]]></xsl:text>

    <xsl:apply-templates select="Namespaces" />

      <section>
        <content>
          <para>
            <link>
              <xsl:attribute name="xlink:href">
                <xsl:value-of select="@SummaryID" />
              </xsl:attribute>
              <xsl:value-of select="@SummaryName" />
            </link>
          </para>
        </content>
      </section>

      <!-- link back to summary -->
      <xsl:text disable-output-escaping="yes"><![CDATA[</developerConceptualDocument>]]></xsl:text>

    </topic>

  </xsl:template>


  <xsl:template match="Namespaces">

    <xsl:apply-templates select="Namespace" />

  </xsl:template>

  <xsl:template match="Namespace">

    <section>
      <xsl:attribute name="address"><xsl:value-of select="@Name" /></xsl:attribute>
      <title><xsl:value-of select="@Name" /></title>
      <content>
        <table>
          <title><xsl:value-of select="@Name" /></title>
          <tableHeader>
            <row>
              <entry>
                <para>Type</para>
              </entry>
            </row>
          </tableHeader>

          <xsl:apply-templates select="Types" />
          
        </table>
      </content>
    </section>


  </xsl:template>

  <xsl:template match="Types">

      <xsl:apply-templates select="Type" />

  </xsl:template>

  <xsl:template match="Type">

    <row>
      <entry>
        <para>
          <xsl:value-of select="@Name" />
        </para>
      </entry>
    </row>

  </xsl:template>

  <xsl:template name="navigation">
    <div id="navigation">
      <ul>
        <li>
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="@SummaryName" />.html
            </xsl:attribute>Summary
          </a>
        </li>
        <li>
          <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
        </li>
        <li>
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="@AssemblyName" />.html
            </xsl:attribute>
            <xsl:value-of select="@AssemblyName" />
          </a>
        </li>
      </ul>
    </div>
  </xsl:template>

</xsl:stylesheet>
